package com.neusoft.boot32.dibuy.repository.impl;

import com.neusoft.boot32.dibuy.entity.Account;
import com.neusoft.boot32.dibuy.repository.IAccountRepsitory;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import static org.junit.jupiter.api.Assertions.*;
@SpringBootTest
class AccountRepsitoryImplTest {
    @Autowired
    IAccountRepsitory repsitory;

    @Test
    void selectAll() {
        repsitory.selectAll().forEach(System.out::println);
    }

    @Test
    void addAccount() {
       int i =  repsitory.addAccount(new com.neusoft.boot32.dibuy.entity.Account());
       assert i > 0;
    }


    @Test
    void selectByName() {
         repsitory.selectByName("admin").forEach(System.out::println);
    }

    @Test
    void upatePassword() {
        int  i =  repsitory.updatePassword( 1, "123"  );
        assert i > 0;
    }

    @Test
    void modAccount() {
         Account account = new Account();
         account.setAutoId(1);
         account.setTel("123");
         account.setUsername("admin0");
        int i = repsitory.modAccount(account);
        assert i > 0;
    }

}